package newTest.test11;

import java.sql.SQLException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import vo.UserVO;

public class testDaoMain {
	
	public static void main(String args[]) throws ClassNotFoundException,SQLException{
		//그런데 이건 원래..분리해서 그냥 테스트 용? 
		
	
//		DaoFactory daoFactory =  new DaoFactory();
		ApplicationContext context = new AnnotationConfigApplicationContext(CountingDaoFactory.class);
//		UserDao userDao = daoFactory.userDao();
		UserDao userDao = context.getBean("userDao",UserDao.class);
		
		UserVO user = new UserVO();
		
		user.setId("newtest3");
		user.setName("testNm");
		user.setPassword("testPw");
		
		userDao.add(user);
		
		System.out.println("등록성공"+user.getName());
		
		UserVO user2 = new UserVO();
		user2 = userDao.get(user.getId());
		
		System.out.println("호출성공 : "+user2.getName());
		
		CountingConnectionMaker ccm = context.getBean("connectionMaker",CountingConnectionMaker.class);
		System.out.println(ccm+" : "+CountingConnectionMaker.class);
		System.out.println("호출갯수 : "+ccm.getCounter());
		
	}
	

}
